import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { Elder_infoVO, Elder_infoForm, Elder_infoQuery } from '@/api/nursing/elder_info/types';

/**
 * 查询老人基础信息列表
 * @param query
 * @returns {*}
 */

export const listElder_info = (query?: Elder_infoQuery): AxiosPromise<Elder_infoVO[]> => {
  return request({
    url: '/nursing/elder_info/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询老人基础信息详细
 * @param elderId
 */
export const getElder_info = (elderId: string | number): AxiosPromise<Elder_infoVO> => {
  return request({
    url: '/nursing/elder_info/' + elderId,
    method: 'get'
  });
};

/**
 * 新增老人基础信息
 * @param data
 */
export const addElder_info = (data: Elder_infoForm) => {
  return request({
    url: '/nursing/elder_info',
    method: 'post',
    data: data
  });
};

/**
 * 修改老人基础信息
 * @param data
 */
export const updateElder_info = (data: Elder_infoForm) => {
  return request({
    url: '/nursing/elder_info',
    method: 'put',
    data: data
  });
};

/**
 * 删除老人基础信息
 * @param elderId
 */
export const delElder_info = (elderId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/elder_info/' + elderId,
    method: 'delete'
  });
};
